package cn.edu.scau.cmi.wujiaming.experiment1;

public class President {

	private static President president;

	private String name;

	private President(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static President getInstance(String name) {
		if (president == null) {
			president = new President(name);
			return president;
		} else if (president.getName().equals(name)) {
			return president;
		} else {
			return null;
		}
	}
}
